home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODF-Interest Archive / September 96 / Embedding help ASAP! < prev    next >
Encoding:
Internet Message Format  |  1996-09-19  |  2.4 KB  |  [TEXT/ttxt]

  1. Subject:     Embedding help ASAP!
  2. Sent:        9/17/96 3:52 PM
  3. Received:    9/17/96 3:52 PM
  4. From:        Adam Nash <adamnash@CS.Stanford.EDU>
  5. Reply-To:    ODF-Interest@CILabs.ORG
  6. To:          OpenDoc Development Framework Discussion List
  7.  
  8.  
  9. Hi Everyone,
  10.     I am trying to embed an empty sound part into my container
  11. when people click on the sound button.  However, I am at a loss as
  12. to how to find the right "type" to embed.  Basically, the idea is
  13. to embed an empty sound, then opening the proxy window so they can
  14. record what they want to.
  15.     (Yes, this will not work if they are using a sound part that
  16. doesn't support record...)
  17.  
  18.     Can anyone help?  How do I embed an empty document of the sound
  19. type?  What is the sound type?
  20.  
  21.      Thanx,
  22.         Adam
  23.  
  24.  
  25. PS Here is the code I am using currently...
  26.  
  27. void CSparkFrame::DoCaptureSound(Environment *ev)
  28. {
  29.     // First Get the selected index
  30.     ODSLong index = GetSelection(ev)->GetSelectedIndex();
  31.     
  32.     // If nothing is selected, get the next empty cell
  33.     if (index == BAD_CELL_INDEX) {
  34.         index = fSparkContent->GetNextEmptyCellIndex();
  35.     } 
  36.     
  37.     // Get the proxy for the index
  38.     CSparkProxy *proxy = fSparkContent->GetProxy(index);
  39.     
  40.     // If it's full, get the next empty one
  41.     if (proxy != NULL) {
  42.         index = fSparkContent->GetNextEmptyCellIndex();
  43.     }
  44.     
  45.     // Adjust view bounds, if necessary
  46.     if (index > fSparkView->GetMaxIndex()) {
  47.         long handle_overfill_here;
  48.         SysBeep(1);
  49.     }
  50.     
  51.     // Get the proxy shape
  52.     FW_CRect cellRect;
  53.     fSparkView->GetCellRect(ev, index, cellRect);
  54.     cellRect.Place(FW_kZeroPoint);
  55.     
  56.     // Acquire the shape
  57.     FW_CAcquiredODShape shape = ::FW_NewODShape(ev, cellRect);
  58.     
  59.     // Ask our draft for the new part
  60.     ODStorageUnit *su = fSparkPart->GetStorageUnit(ev);
  61.     ODDraft *draft = su->GetDraft(ev);
  62.     FW_CAcquiredODPart newPart = draft->CreatePart(ev, kODCategorySampledSound, kODNoEditor);
  63.     
  64.     FW_ASSERT(newPart != NULL);
  65.     
  66.     // Create a proxy for the part
  67.     // Name Hack...
  68.     proxy = new CSparkProxy(ev, fSparkPart, fSparkContent, "Untitled Sound", 123456L, FW_CTime::GetCurrentTime());
  69.  
  70.     // Embed the part into our content
  71.     proxy->Embed(ev, GetPresentation(ev), newPart, GetODFrame(ev), kODFrameObject, shape, 
  72.                                             GetPresentation(ev)->GetDefaultEmbeddedFrameViewType(ev),
  73.                                             NULL, 0, false, false);
  74.                             
  75.     // Select the proxy
  76.     SelectCell(ev, index);
  77.                     
  78.     // Open the window for the part
  79.     proxy->OpenInWindow(ev, proxy->GetProxyFrame(ev, this));
  80. }